<?php defined('SYSPATH') or die('No direct script access.');
require ('application/classes/dao/base.php');
class Controller_expressm extends Controller {


	public function action_index(){

		$parm = post($this->request);


		echo View::factory('manager/express');
	}
    public function action_detail(){
        $parm = get($this->request);
        $result = rpcCall("express.detail",$parm);
        echo View::factory('manager/updateExpress')->bind("express",$result);
    }
	public function action_getData(){

		$parm = get($this->request);
		if(!isset($parm['page']) ||($parm['page'])==""){
        	echo "page不能为空";
            exit;
        }
        if(!isset($parm['rows']) ||($parm['rows'])==""){
        	echo "rows能为空";
            exit;
        }

        $data=rpcCall("express.listdata",$parm);
        echo json_encode($data);
	}
	
	public function action_addDialog(){
		$parm = get($this->request);
		echo View::factory('manager/addExpress');

	}
	public function action_addExpress(){


		$parm = post($this->request);

		if(!isset($parm['name']) ||($parm['name'])==""){
        	echo "快递名称不能为空";
            exit;
        }
        if(!isset($parm['price']) ||($parm['price'])==""){
        	echo "快递价格不能为空";
            exit;
        }

        $result = rpcCall("express.add",$parm);
        echo "<script>window.location.href='".Url::base()."index.php/expressm/index'</script>";
	}

    
    public function action_updateExpress(){


        $parm = post($this->request);

        

        $result = rpcCall("express.update",$parm);
        echo "<script>window.location.href='".Url::base()."index.php/expressm/index'</script>";
    }
}
